//
//  HHPLivingViewModel.m
//  HHPLiveVideo
//
//  Created by 韩红坡 on 2017/4/25.
//  Copyright © 2017年 韩红坡. All rights reserved.
//

#import "HHPLivingViewModel.h"
#import "HHPLivingService.h"

@interface HHPLivingViewModel ()

@property (nonatomic, strong) HHPLivingService *service;

@end

@implementation HHPLivingViewModel
- (void)fetchLiveFlvDataWithUrl:(NSString *)url successBlock:(void (^)())successBlock errorBlock:(void (^)(NSError *))errorBlock
{
    HHPHTTPRequest *request = [self.service fetchLiveFlvDataWithUrl:url];
    
    [request startWithSuccess:^(HHPHTTPRequest *request) {
        successBlock();
    } error:^(HHPHTTPRequest *request) {
        errorBlock(request.error);
    }];
}

#pragma mark - getter and setter
- (HHPLivingService *)service
{
    if (!_service) {
        _service = [[HHPLivingService alloc] init];
    }
    
    return _service;
}

@end
